/*
 * MyJsonController.java
 * Feb 12, 2013 
 */
package com.jramoyo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author jramoyo
 */
@Controller
public class MyJsonController {
	private final UserService userService = new UserService();

	@RequestMapping(value = "/user/{username}", method = RequestMethod.GET)
	public @ResponseBody
	User getUser(@PathVariable String username) {
		return userService.getUser(username);
	}

	// Mocked for illustration purposes
	private static class UserService {
		public User getUser(String username) {
			User user = new User(username);
			user.setFirstName("Jan");
			user.setLastName("Amoyo");

			return user;
		}
	}
}